﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class TypeProcess_NewForm : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btnSave_Click(object sender, EventArgs e)
    {
        Model.TypeProcessManager typeProcessManager = new Model.TypeProcessManager();
        Model.TypeProcess typeProcess = new Model.TypeProcess();        
        typeProcess.Name = txtName.Text;
        int newArticleID = typeProcessManager.Save(typeProcess);

       
        if (newArticleID != 0)
        {
            lblConfirmation.Text = "The new article has been successfuly saved!";
            lblConfirmation.Visible = true;
        }
        else
        {
            lblConfirmation.Text = "Oups! Something went wrong!";
            lblConfirmation.Visible = true;
        }

        ClearForm();
    }

    private void ClearForm()
    {
        txtName.Text = String.Empty;        
    }

    protected void btnGoBack_Click(object sender, EventArgs e)
    {
        Response.Redirect("ListView.aspx");
    }
}